package com.tianpengcc.service.impl;

import java.util.List;

import com.tianpengcc.dao.DirayTypeDAO;
import com.tianpengcc.dao.impl.DirayTypeDAOImpl;
import com.tianpengcc.model.DirayType;
import com.tianpengcc.model.custom.DirayTypeCustom;
import com.tianpengcc.service.DirayTypeService;

public class DirayTypeServiceImpl implements DirayTypeService {
	
	private DirayTypeDAO dirayTypeDAO = null ;
	
	public DirayTypeServiceImpl(){
		dirayTypeDAO = new DirayTypeDAOImpl() ;
	}
	
	@Override
	public List<DirayTypeCustom> getAll() throws Exception {
		
		return dirayTypeDAO.findDirayCountAndDirayType();
	}

	@Override
	public List<DirayType> getDirayType() throws Exception {
		List<DirayType> list = dirayTypeDAO.findAll();
		return list;
	}

	@Override
	public void doAdd(DirayType dirayType) throws Exception {
		dirayTypeDAO.doCreate(dirayType);
	}

	@Override
	public void doUpdate(Integer dirayTypeId, DirayType dirayType)
			throws Exception {
		dirayTypeDAO.doUpdate(dirayTypeId, dirayType);
	}

	@Override
	public void doDelete(Integer dirayTypeId) throws Exception {
		dirayTypeDAO.doDelete(dirayTypeId);
		
	}

	@Override
	public DirayType getById(Integer dirayTypeId) throws Exception {
		return dirayTypeDAO.findById(dirayTypeId);
	}

}
